package com.tpc.control.jpa;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Company entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "company", catalog = "production_control")
public class Company implements java.io.Serializable {

	// Fields

	private String companyId;
	private String companyName;
	private String onLoading;
	private Timestamp lastUpdate;
	private String inputFileName;
	private String inactUpload;
	private Timestamp lastUpload;
	private Set<SaleData> saleDatas = new HashSet<SaleData>(0);

	// Constructors

	/** default constructor */
	public Company() {
	}

	/** minimal constructor */
	public Company(String companyId, String companyName, String onLoading,
			String inputFileName, String inactUpload) {
		this.companyId = companyId;
		this.companyName = companyName;
		this.onLoading = onLoading;
		this.inputFileName = inputFileName;
		this.inactUpload = inactUpload;
	}

	/** full constructor */
	public Company(String companyId, String companyName, String onLoading,
			Timestamp lastUpdate, String inputFileName, String inactUpload,
			Timestamp lastUpload, Set<SaleData> saleDatas) {
		this.companyId = companyId;
		this.companyName = companyName;
		this.onLoading = onLoading;
		this.lastUpdate = lastUpdate;
		this.inputFileName = inputFileName;
		this.inactUpload = inactUpload;
		this.lastUpload = lastUpload;
		this.saleDatas = saleDatas;
	}

	// Property accessors
	@Id
	@Column(name = "company_id", unique = true, nullable = false, length = 4)
	public String getCompanyId() {
		return this.companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}

	@Column(name = "company_name", nullable = false, length = 100)
	public String getCompanyName() {
		return this.companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	@Column(name = "on_loading", nullable = false, length = 1)
	public String getOnLoading() {
		return this.onLoading;
	}

	public void setOnLoading(String onLoading) {
		this.onLoading = onLoading;
	}

	@Column(name = "last_update", length = 19)
	public Timestamp getLastUpdate() {
		return this.lastUpdate;
	}

	public void setLastUpdate(Timestamp lastUpdate) {
		this.lastUpdate = lastUpdate;
	}

	@Column(name = "input_file_name", nullable = false, length = 200)
	public String getInputFileName() {
		return this.inputFileName;
	}

	public void setInputFileName(String inputFileName) {
		this.inputFileName = inputFileName;
	}

	@Column(name = "inact_upload", nullable = false, length = 1)
	public String getInactUpload() {
		return this.inactUpload;
	}

	public void setInactUpload(String inactUpload) {
		this.inactUpload = inactUpload;
	}

	@Column(name = "last_upload", length = 19)
	public Timestamp getLastUpload() {
		return this.lastUpload;
	}

	public void setLastUpload(Timestamp lastUpload) {
		this.lastUpload = lastUpload;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "company")
	public Set<SaleData> getSaleDatas() {
		return this.saleDatas;
	}

	public void setSaleDatas(Set<SaleData> saleDatas) {
		this.saleDatas = saleDatas;
	}

}